import React from 'react';
import ReactEcharts from 'echarts-for-react';
import {Button} from 'antd';
import Reflux from 'reflux';
import EChartSampleStore from '../../stores/Samples/EChartSampleStore'
import EChartSampleAction from '../../actions/Samples/EChartSampleAction'
import SimpleTable from "../../compoments/Tables/SimpleTable";

class EChartSample extends Reflux.Component {

    constructor(props) {
        super(props);
        this.echarts = {}
        this.store = EChartSampleStore;
    }

    showChart() {
        EChartSampleAction.showChart();
    }


    render() {
        let toolbarBtns = []
        toolbarBtns.push(
            <Button type="primary" style={{marginRight: '5px'}} onClick={this.showChart}>显示图表</Button>
        )
        return (
            <div className="App">
                <div style={{textAlign: 'right', marginBottom: '1%'}}>

                </div>
                {this.state.options === undefined ? "" :
                    <ReactEcharts
                        ref={(e) => {
                            this.echarts = e;
                        }}
                        option={this.state.options}
                        lazyUpdate={true}/>
                }
                <SimpleTable toolbarBtns={toolbarBtns} loading={false} dataSource={this.state.dataSource}
                             columns={this.state.columns}/>
            </div>
        );
    }
}

export default EChartSample;
